IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WorkflowInstanceAuditTrails]') AND type in (N'U'))
DROP TABLE [dbo].[WorkflowInstanceAuditTrails]
GO
/****** Object:  Table [dbo].[WorkflowInstances]    Script Date: 10/21/2010 20:47:52 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[WorkflowInstances]') AND type in (N'U'))
DROP TABLE [dbo].[WorkflowInstances]
GO
CREATE TABLE [dbo].[WorkflowInstances](
	[WorkflowInstanceId] [int] IDENTITY(1,1) NOT NULL,
	[WorkflowName] [nvarchar](500) NOT NULL,
	[Comments] [nvarchar](500) NULL,
	[StateName] [nvarchar](500) NOT NULL,
	[ActivityName] [nvarchar](500) NOT NULL,
	[ActionName] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[LastModifiedBy] [nvarchar](500) NOT NULL,
	[LastModifiedOn] [datetime] NOT NULL,
	[Attributes] [varchar](5000) NULL,
	[WorkflowType] [varchar](500) NULL,
 CONSTRAINT [PK_WorkflowInstances] PRIMARY KEY CLUSTERED 
(
	[WorkflowInstanceId] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
CREATE TABLE [dbo].[WorkflowInstanceAuditTrails](
	[WorkflowInstanceAuditTrailID] [int] IDENTITY(1,1) NOT NULL,
	[WorkflowInstanceId] [int] NOT NULL,
	[WorkflowName] [nvarchar](500) NOT NULL,
	[Comments] [nvarchar](500) NULL,
	[StateName] [nvarchar](500) NOT NULL,
	[ActivityName] [nvarchar](500) NOT NULL,
	[ActionName] [nvarchar](500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
	[LastModifiedBy] [nvarchar](500) NOT NULL,
	[LastModifiedOn] [datetime] NOT NULL,
	[Attributes] [varchar](5000) NULL,
	[WorkflowType] [varchar](500) NULL,
 CONSTRAINT [PK_WorkflowInstanceAuditTrails] PRIMARY KEY CLUSTERED 
(
	[WorkflowInstanceAuditTrailID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO